package cn.com.surker.material.entity;

import cn.com.surker.enums.material.MaterialType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 材料入库记录中的材料,和入库记录是一对多的关系,一个入库记录有多种材料
 * </p>
 *
 * @author admin
 * @since 2023-07-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class MaterialStorageItemDetail extends MaterialStorageItem {

	private String materialName;

	private String materialBrand;

	private String materialNorms;

	private String materialUnit;

	private Integer materialType;

	private String materialTypeName;

	public String getMaterialTypeName(){
		if(this.materialType != null){
			MaterialType[] values = MaterialType.values();
			for (int i = 0,s = values.length;i < s;i++){
				MaterialType value = values[i];
				if(value.getCode().equals(this.materialType)){
					return value.getDescription();
				}
			}
			return null;
		}else {
			return null;
		}
	}

}
